import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 创建习题对象
        String question = "Java是一种______编程语言。";
        String[] options = {"A. 编译型", "B. 解释型", "C. 机器码", "D. 汇编"};
        int correctAnswer = 1; // 正确答案是B，索引为1
        Exercise exercise = new Exercise(question, options, correctAnswer);

        // 显示题目和选项
        exercise.displayQuestion();
        exercise.displayOptions();

        // 用户输入答案
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入你的答案（A、B、C或D）：");
        String userAnswer = scanner.next();

        // 检查答案
        if (exercise.checkAnswer(userAnswer.toUpperCase().charAt(0) - 'A')) {
            System.out.println("恭喜你，答对了！");
        } else {
            System.out.println("很遗憾，答错了。正确答案是：" + exercise.getCorrectAnswer());
        }
    }
}